<?php

use yii\helpers\Html;
use metronic\grid\GridView;

/* @var $model common\models\Category */
?>

<?= GridView::widget([
    'dataProvider' => $dataProvider,
    'columns' => [
        ['class' => 'yii\grid\SerialColumn'],

        'name',

        'category.title',

        'author',

        'statusText',

        [
            'attribute' => 'cover',
            'format' => 'raw',
            'enableSorting' => false,
            'value' => function ($model) {
                return Html::img($model->cover->resize(100, 75), ['style' => 'width:75px; height:100px']);
            }
        ],

        [
            'class' => 'metronic\grid\ActionColumn',
            'template' => '{chapter} {update} {delete}',
            'buttons' => [
                'chapter' => function ($url, $model) {
                    return Html::a('<i class="fa fa-book"> 章节管理</i>', ['book-chapter/index', 'book_id' => $model->id], ['class' => 'btn btn-outline btn-circle btn-xs blue']);
                }
            ],
        ],

    ],
]); ?>
